package com.zk.algorithm.factory;

import com.zk.algorithm.bean.ListNode;

public class ListFactory {

    public static final ListNode create(int[] arr) {
        ListNode head = new ListNode(arr[0]);
        ListNode pointer = head;

        for (int i=1; i<arr.length; i++) {
            ListNode next = new ListNode(arr[i]);
            pointer.setNext(next);
            pointer = next;
        }

        return head;
    }

}
